#pragma once
#include <memory>
#include "DesktopFrame.h"

class SharedDesktopFrame:public DesktopFrame
{
public:
	~SharedDesktopFrame() override;

	static std::unique_ptr<SharedDesktopFrame> Wrap(
		std::unique_ptr<DesktopFrame> desktop_frame);

	static SharedDesktopFrame* Wrap(DesktopFrame* desktop_frame);

	DesktopFrame* GetUnderlyingFrame();

	bool ShareFrameWith(const SharedDesktopFrame& other) const;

	std::unique_ptr<SharedDesktopFrame> Share();

	bool IsShared();
private:
	typedef std::unique_ptr<DesktopFrame> Core;

	SharedDesktopFrame(std::shared_ptr<Core> core);
	const std::shared_ptr<Core> core_;

	SharedDesktopFrame(const SharedDesktopFrame&) = delete;
	SharedDesktopFrame& operator=(const SharedDesktopFrame&) = delete;
};

